#include <bits/stdc++.h>
using namespace std;
int f1(int k) {
  int ans = 0;
  while (k > 0) {
    ans++;
    k /= 10;
  }
  return ans;
}

int f2(int k) { return to_string(k).size(); }

int f3(int k) { return floor(log10(k)) + 1; }
int f4(int k) { return k >= 10000 && k < 100000; }

int main() {
  int T;
  cin >> T;
  for (int i = 1; i <= T; i++) {
    int n, x;
    cin >> n >> x;
    if (f1(n * x) == 5)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}